package cn.com.open.itembank.service;

import cn.com.open.itembank.dto.Category;
import cn.com.open.itembank.dto.ReturnModel;
import cn.com.open.itembank.entity.QuestionCategory;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by lucky on 2017/9/4.
 */
@FeignClient(name = "item-base-service")
public interface QuestionCategoryRemoteService {

    /**
     * 根据试题应用类别id获取可用试题应用类别信息.
     *
     * @param id 试题应用类别id
     * @return 可用题库信息 question category info
     */
    @GetMapping(value = "/questioncategory/{id}")
    QuestionCategory getQuestionCategoryInfo(@PathVariable(value = "id") String id);

    /**
     * 获取试题应用类别名称信息
     *
     * @param name    试题应用类别名称
     * @return the list
     */
    @GetMapping(value = "/questioncategory")
    List<QuestionCategory> getList(@RequestParam(value = "name") String name);

    /**
     * 获取试题应用类别名称信息
     *
     * @param name    试题应用类别名称
     * @return the list
     */
    @GetMapping(value = "/questioncategory/enabledlist")
    List<QuestionCategory> getEnabledList(@RequestParam(value = "name") String name);


    /**
     * 新增试题应用类别.
     *
     * @param model the model
     * @return the int
     */
    @PostMapping(value = "/questioncategory")
    ReturnModel insert(@RequestBody Category model);

    /**
     * 修改试题应用类别.
     *
     * @param id   试题应用类别id
     * @param name 试题应用类别名称
     * @return the int
     */
    @PutMapping(value = "/questioncategory/{id}")
    int update(@PathVariable(value = "id") String id, @RequestParam("name") String name);

    /**
     * 更新试题应用类别状态.
     *
     * @param id 试题应用类别ID
     * @return the int
     */
    @PutMapping(value = "/questioncategory/{id}/status")
    int changeStatus(@PathVariable(value = "id") String id);

    /**
     * 删除试题应用类别
     *
     * @param id 试题应用类别id
     * @return the int
     */
    @DeleteMapping(value = "questioncategory/{id}")
    int delete(@PathVariable(value = "id") String id);
}
